package org.jeecg.modules.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.system.vo.MemberModel;
import org.jeecg.config.app.AppContext;
import org.jeecg.modules.api.announcement.entity.Announcement;
import org.jeecg.modules.api.order.entity.Order;
import org.jeecg.modules.api.order.service.IOrderService;
import org.jeecg.modules.app.service.IAppOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description: 小程序分销订单
 * @author: Young Jun
 * @date: 2024年09月30日 16:18
 */
@Service
public class AppOrderServiceImpl implements IAppOrderService {
    @Autowired
    private IOrderService orderService;

    @Override
    public IPage<Order> getOrderByPage(Integer pageNo, Integer pageSize) {
        MemberModel memberModel = AppContext.get();
        LambdaQueryWrapper<Order> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Order::getTeamId, String.valueOf(memberModel.getId()));
        queryWrapper.orderByDesc(Order::getCreateTime);
        Page<Order> page = new Page<Order>(pageNo, pageSize);
        return orderService.page(page, queryWrapper);
    }
}
